package com.spring.application;

import com.spring.entity.Person;
import org.junit.Test;
import org.junit.runner.notification.RunListener;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringApplication_1 {

    //测试null
    @Test
    public void getBeanNull(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-1.xml");
        Person person1 = context.getBean("person01", Person.class);
        System.out.println(person1);
    }
    //引用外部内容ref
    @Test
    public void getBeanRef(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-1.xml");
        Person person1 = context.getBean("person01", Person.class);
        System.out.println(person1);
    }
    //测试list
    @Test
    public void getBeanList(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-1.xml");
        Person person1 = context.getBean("person01", Person.class);
        System.out.println(person1);
    }
    //测试Map
    @Test
    public void getBeanMap(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-1.xml");
        Person person1 = context.getBean("person01", Person.class);
        System.out.println(person1);
    }
    //测试Properties
    @Test
    public void getBeanProperties(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-1.xml");
        Person person1 = context.getBean("person01", Person.class);
        System.out.println(person1.getProperties());
    }
    //测试util名称空间
    @Test
    public void getBeanUtil(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-1.xml");
        Person person1 = context.getBean("person02", Person.class);
        System.out.println(person1);
    }
    //级联属性赋值测试
    @Test
    public void getBeanConstantFiled(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-1.xml");
        Person person1 = context.getBean("person03", Person.class);
        System.out.println(person1);
    }

    //配置信息的重复使用  person04
    @Test
    public void getBeanRepiteInfo(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-1.xml");
        Person person1 = context.getBean("person05", Person.class);
        System.out.println(person1);
    }


}
